import {Component, OnInit, ViewChild} from '@angular/core';
import {Car} from './domain/car';
import {CarService} from './service/car.service';
import {BaseListComponent} from '../shared/component';

@Component({
  selector: 'app-demo-index',
  templateUrl: './demo.component.html',
  styleUrls: ['./demo.component.css']
})
export class DemoComponent implements OnInit {

  cars: Car[];

  cols: any[];
  // @ViewChild('list') list: BaseListComponent ;
  constructor(private carService: CarService) { }

  ngOnInit() {
    this.carService.getCarsSmall().then(cars => {
      this.cars = cars;
      // this.list.list = this.cars;
    });

    this.cols = [
      { field: 'vin', header: 'Vin' },
      { field: 'year', header: 'Year' },
      { field: 'brand', header: 'Brand' },
      { field: 'color', header: 'Color' }
    ];

    // this.list.cols = this.cols;
  }
}
